//
//  TCPSocketIOPackTransport.h
//  RunSketch
//
//  Created by Brian on 9/5/09.
//  Copyright 2009 Tellart. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "IOPackTransport.h"
#import "IOPack.h"
#import "Socket.h"

#define TCPSocketIOPackTransport_EX_NOT_SET_UP                @"TCPSocketIOPackTransport: call connectToHostName before using any other methods of this object"
#define kDefaultTCPSocketPort 1025

@interface TCPSocketIOPackTransport : NSObject <IOPackTransport>
{
    BOOL hasBeenSetUp;
    
    IOPack *ioPack;

    NSString *hostName;
    unsigned int port;
    Socket *csocket;
    BOOL isConnecting;
    
    NSString *deviceAddress;
}


- (void)connectToHostName:(NSString*)pHostName port:(unsigned short)pPort;

/** Begin IOPackTransport implementation **/
@property (nonatomic, retain, readonly) NSString *deviceAddress;
@property (nonatomic, retain) IOPack *ioPack;
- (int)numOutputChannels;
- (int)numInputChannels;
- (BOOL)isConnectedAndReady;
- (BOOL)isReadable;
- (BOOL)isWritable;
/*
- (int)readData:(NSMutableData*)data;
- (int)readDataAndReplace:(NSMutableData*)data;
*/
- (int)read;
- (BOOL)writeData:(NSData*)data;
/** End IOPackTransport implementation **/

@end
